package com.itheima.service.impl;

import com.itheima.entity.EmpLog;
import com.itheima.mapper.EmpLogMapper;
import com.itheima.service.EmpLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class EmpLogServicempImpl implements EmpLogService {

    @Autowired
    private EmpLogMapper empLogMapper;


//    插入操作日志

  //  @Transactional(propagation = Propagation.REQUIRED)默认值，无则创建有则添加
    @Transactional(propagation = Propagation.REQUIRES_NEW)//开启新事物
    public void insertLog(EmpLog empLog) {
        empLogMapper.insert(empLog);

    }
}
